<template>
	<view class="bigbox">
		<image class="icon" src="../../static/27.png" mode=""></image>
		<view class="fot1">修改密码</view>
		<!-- 账号密码登录 -->
		<view>
			<view class="fot2">账号</view>
			<view class="iut1">{{username}}</view>
			<view class="fot2">新密码</view>
			<input class="iut1" v-model=" password" placeholder-style="color:#CCCCCC;" type="text" value="" placeholder="请输入" />
			<view class="fot2">再次输入</view>
			<input class="iut1" v-model=" password1" placeholder-style="color:#CCCCCC;" type="text" value="" placeholder="请输入" />
			<button style="margin-top: 60rpx;" class="all_btn" @click="xiugai()">确认</button>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			username:'',
			password:'',
			password1:''
		}
	},
	mounted() {
		this.username = uni.getStorageSync('login').username
	},
	methods: {
		xiugai:function(){
			if(this.username == ''|| this.password == '' || this.password1 == ''){
				uni.showToast({
					title:'请填写完整',
					icon:'none'
				})
			}else if(this.password != this.password1){
				uni.showToast({
					title:'二次密码不一致',
					icon:'none'
				})
			}else{
				uni.request({
				    url: this.$headUrl + 'sys/user/appchangePassword', //仅为示例，并非真实接口地址。
				    data: {
				       username: this.username,
				       password: this.password
				    },
					method:'POST',
				    header: {
				        'X-Access-Token': uni.getStorageSync('token')
				    },
				    success: (res) => {
						uni.showToast({
							title:res.data.message,
							icon:'none'
						})
				        console.log(res.data);
				    }
				});
				
				
				
			}
		}
	}
}
</script>

<style>
	.box4{
		position: relative;
	}
	.yzm{
		width: 180rpx;
		height: 50rpx;
		border-radius: 10rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		color: #3a62ff;
		border: 1px solid #3a62ff;
		position: absolute;
		right: 10rpx;
		bottom: 10rpx;
	}
		
	.text {
		display: inline-block;
		margin-top: 40rpx;
		color: #3a62ff;
	}
	.iut1 {
		height: 60rpx;
		border-bottom: 1px solid #e5e5e5;
	}
	.fot2 {
		margin: 40rpx 0;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
	}
	.fot1 {
		font-size: 48rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(51, 51, 51, 1);
		margin-top: 240rpx;
		margin-bottom: 110rpx;
	}
	.icon {
		width: 391rpx;
		height: 432rpx;
		position: fixed;
		top: -100rpx;
		right: -100rpx;
	}
	.bigbox {
		padding: 0 61rpx;
		box-sizing: border-box;
	}
</style>
